<template>
	<view class="container">
		<view class="head">
			<image src="../../../static/images/ym_bg.png" mode=""
				style="width: 100%;height: 100%;position: absolute;top: 0;"></image>
			<view class="">
				<text>154646</text>
				<text>当前易米</text>
			</view>
			<text></text>
			<view class="">
				<text>154646</text>
				<text>昨日易米</text>
			</view>
		</view>
		<view class="list">
			<view class="top">
				<text class="icon"></text>
				<text class="text">历史记录</text>
			</view>
			<z-paging ref="paging" :fixed="false" v-model="list" @query="queryList">
				<view class="item" v-for="(item,index) in list" :key="index">
					<text>2023-10-29</text>
					<text>7.111111546</text>
				</view>
			</z-paging>

		</view>
	</view>
</template>

<script>
	let _this;
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			_this = this;
		},
		methods: {
			queryList(pageNo, pageSize) {
				//这里的pageNo和pageSize会自动计算好，直接传给服务器即可
				//这里的请求只是演示，请替换成自己的项目的网络请求，并在网络请求回调中通过this.$refs.paging.complete(请求回来的数组)将请求结果传给z-paging
				// this.$request.queryList({
				// 	pageNo,
				// 	pageSize
				// }).then(res => {
				// 	//请勿在网络请求回调中给dataList赋值！！只需要调用complete就可以了
				// 	this.$refs.paging.complete(res.data.list);
				// }).catch(res => {
				// 	//如果请求失败写this.$refs.paging.complete(false)，会自动展示错误页面
				// 	//注意，每次都需要在catch中写这句话很麻烦，z-paging提供了方案可以全局统一处理
				// 	//在底层的网络请求抛出异常时，写uni.$emit('z-paging-error-emit');即可
				// 	this.$refs.paging.complete(false);
				// })
				setTimeout(function() {
					_this.$refs.paging.complete([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
				}, 1000)
			}
		}
	}
</script>

<style lang="scss" scoped>
	body,
	html {
		height: 100% !important;
	}

	uni-page-body {
		height: 100%;

	}

	.container {
		width: 100%;
		height: 100%;
		padding: 30rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		position: relative;
	}

	.head {
		width: 100%;
		height: 160rpx;
		display: flex;
		position: relative;
		justify-content: space-between;
		align-items: center;
		padding-bottom: 20rpx;
		box-sizing: border-box;

		>text {
			display: inline-block;
			height: 50%;
			width: 2rpx;
			background-color: #FFB399;
			z-index: 2;
		}

		>view {
			flex: 1;
			display: flex;
			flex-direction: column;
			align-items: center;
			z-index: 2;
			color: #fff;

			>text:nth-of-type(1) {
				font-size: 32rpx;
				margin-bottom: 16rpx;
			}

			>text:nth-of-type(2) {
				font-size: 22rpx;
			}
		}

	}


	.list {
		width: 100%;
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		opacity: 1;
		padding: 24rpx 16rpx;
		box-sizing: border-box;
		height: calc(100% - 160rpx);
		display: flex;
		flex-direction: column;


		.top {
			display: flex;
			align-items: center;

			.icon {
				display: inline-block;
				width: 4rpx;
				height: 16rpx;
				background: #FF7547;
				border-radius: 8rpx 8rpx 8rpx 8rpx;
				opacity: 1;
			}

			.text {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #333333;
				line-height: 38rpx;
				-webkit-background-clip: text;
				margin-left: 8rpx;
			}
		}
		.item {
			width: 100%;
			height: 68rpx;
			border-bottom: 2rpx solid #f5f5f5;
			display: flex;
			justify-content: space-between;
			align-items: center;

			>text:nth-of-type(1) {
				font-size: 24rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500 !important;
				color: #333333;
				line-height: 28rpx;
			}

			>text:nth-of-type(2) {
				font-size: 24rpx;
				font-family: Source Han Sans CN-Regular, Source Han Sans CN;
				font-weight: 400 !important;
				color: #333333;
				line-height: 28rpx;
			}

		}
	}
</style>